package com.hirelinfo.service.student;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hirelinfo.dao.faculty.HibernateDao;
import com.hirelinfo.dto.student.Student;

@Service
public class StudentManagerService {
	
	@Autowired
	HibernateDao commonDao;
	
	
	
	public void saveNewStudent(Student student){

		if(null!=student){
			commonDao.insertNewRow(student);
		}
		
	}
	
	public List<Student> getAllMaleStudent(){
		
		DetachedCriteria criteria=DetachedCriteria.forClass(Student.class);
	      criteria.add(Restrictions.eq("gender", "M"));
	      
	List list=      commonDao.loadAllRowsForCriteria(criteria);
	 if(null!=list && list.size()>0){
		 
		 System.out.println("Student List is not found.");
		 
	 }
	
	
	      
		return list;
	}
	
	
	
	
	
	
	

}
